#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
int main()
{
	int n, str[10], i, x, temp;
	scanf("%d\n", &n);
	for (i = 0;i < n;i++)
	{
		scanf("%d", &x);
		str[i] = x;
	}
	for (i = 0;i < n / 2;i++)
	{
		temp = str[i];
		str[i] = str[n - 1 - i];
		str[n - 1 - i] = temp;
	}
	for (i = 0;i < n;i++)
	{
		printf("%d", str[i]);
		if (i != n - 1)
		{
			printf(" ");//
		}
	}
	return 0;
}
#include<stdio.h>
int main()
{
	int n, i, j, k, temp, count;
	scanf("%d", &n);
	int a[n];
	for (i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	for (j = 0;j < n - 1;j++)
	{
		count = j;
		for (k = count + 1;k < n;k++)
		{
			if (a[k] > a[j]) { temp = a[j];a[j] = a[k];a[k] = temp; }
		}
	}
	for (i = 0;i < n;i++)
	{
		printf("%d", a[i]);
		if (i < n - 1) { printf(" "); }
	}

	return 0;
}
#include<stdio.h>
int main()
{
	int n, a[10], i, min, max, min1 = 0, max1 = 0, t;
	scanf("%d", &n);
	for (i = 0;i < n;i++) {
		scanf("%d", &a[i]);
		getchar();
	}
	max = a[0];
	min = a[0];
	for (i = 1;i < n;i++) {
		if (max < a[i]) {
			max1 = i;
			max = a[i];
		}
		if (min > a[i]) {
			min1 = i;
			min = a[i];
		}
	}
	t = a[0];
	a[0] = a[min1];
	a[min1] = t;
	if (max1 == 0)
		max1 = min1;
	t = a[n - 1];
	a[n - 1] = a[max1];
	a[max1] = t;
	for (i = 0;i < n;i++) {
		printf("%d ", a[i]);
	}

	return 0;
}
#include <stdio.h>
int main()
{
	int a[10] = { 0 };
	int k, i, s, N, m, max;
	max = 0;
	scanf("%d", &N);
	for (i = 0;i < N;i++)
	{
		scanf("%d", &s);
		if (s == 0)
		{
			a[0] += 1;
		}
		for (;s > 0;)
		{
			m = s % 10;
			for (k = 0;k < 10;k++)
			{
				if (m == k)
				{
					a[k] += 1;
				}
			}
			s = s / 10;
		}
	}
	for (i = 0;i < 10;i++)
	{
		if (a[i] >= max)
		{
			max = a[i];
		}

	}
	printf("%d:", max);
	for (i = 0;i < 10;i++)
	{
		if (a[i] == max)
		{
			printf(" %d", i);
		}
	}
	return 0;
}
#include<stdio.h>
int main()
{
	int n, x;

	scanf("%d %d", &n, &x);

	int a[n], i = 0, flag = 0;

	for (i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}

	for (i = 0; i < n; i++)
	{
		if (a[i] == x)
		{
			printf("%d\n", i);
			exit(0);
		}
	}

	printf("Not Found\n");

	return 0;
}
#include<stdio.h>
int main()
{
	int a[10][10], n, sum = 0, sum1 = 0;
	scanf("%d", &n);
	for (int i = 0;i < n;i++)
		for (int j = 0;j < n;j++)
		{
			scanf("%d", *(a + i) + j);sum += *(*(a + i) + j);
		}
	int duijiao = n - 2;
	for (int i = 1;i <= n - 2;i++)//
		sum1 += *(*(a + duijiao--) + i);
	for (int i = 0;i < n - 1;i++)
		sum1 += *(*(a + n - 1) + i);
	for (int i = 0;i < n;i++)
		sum1 += *(*(a + i) + n - 1);
	printf("%d", sum - sum1);
	return 0;
}
#include <stdio.h>

int main()
{
	int num, n, i, j, k, flag = 1;
	int a[10][10];
	scanf("%d", &num);
	for (i = 0; i < num; i++)
	{
		flag = 1;
		scanf("%d", &n);
		for (j = 0; j < n; j++)
		{
			for (k = 0; k < n; k++)
			{
				scanf("%d", &a[j][k]);
				if (k < j && a[j][k] != 0)
					flag = 0;
			}
		}
		if (flag == 1)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}



